package com.mobi.Survey.lib.db;

import android.database.sqlite.SQLiteDatabase;

/**
 * 
 * <p>
 * <b>Author:</b> Yahya Arshad
 * <p>
 * <b>Company:</b> Mobi Media Soft
 * <p>
 * <b> Website:</b> www.mobimediasoft.com
 * <p>
 * TableFactory.java Creates tables of given Table Class
 * 
 */
public class TableFactory {

	private static TableFactory tableFactory;

	private TableFactory() {

	}

	public static final TableFactory getFactory() {
		return tableFactory == null ? tableFactory = new TableFactory()
				: tableFactory;
	}

	/**
	 * 
	 * @param table
	 *            new TableClass()
	 * @param sqlDb
	 *            instance of sql lite db
	 * @return true if success
	 */
	public boolean createTable(AbstractTable table, SQLiteDatabase sqlDb) {
		if (table instanceof AbstractTable) {
			return table.createTable(sqlDb);
		}
		return false;

	}

}
